package cn.lcfms.app.index.controller;



import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.lcfms.app.BaseController;
import cn.lcfms.app.admin.service.DataService;
import cn.lcfms.bin.core.Application;
import cn.lcfms.utils.HttpUtils;
import cn.lcfms.utils.Vardump;



@Controller("index.IndexController")
@RequestMapping("/index/index")
public class IndexController extends BaseController{
	@Autowired
	private DataService ds;
	
	protected void beforeProtected(HttpServletRequest request,HttpServletResponse response) {
		super.beforeProtected(request,response);
    	String basePath=(String) request.getAttribute("APP");
    	request.setAttribute("JS", basePath+"statics/index/js/"); 
    	request.setAttribute("CSS", basePath+"statics/index/css/"); 
    	request.setAttribute("IMG", basePath+"statics/index/images/"); 
	}
	
	//网站首页
	@RequestMapping("/init.html")
	public String init() {		
		return "index/index";
	}
	
	
	//关于我们
	@RequestMapping("/about.html")
	public String about() {		
		return "index/about";
	}
	
	//网站案例
	@RequestMapping("/case.html")
	public String _case() {	
		List<HashMap<String, Object>> list = ds.getArticleList(1, 9, 1);
		HttpServletRequest request = Application.getRequest();
		request.setAttribute("list", list);
		Vardump.print(list);
		return "index/case";
	}
	
	//服务范围
	@RequestMapping("/service.html")
	public String service() {		
		return "index/service";
	}
	
	//app
	@RequestMapping("/app.html")
	public String app() {		
		return "index/app";
	}
	
	//解决方案
	@RequestMapping("/program.html")
	public String program() {		
		return "index/program";
	}
	
	//新闻中心
	@RequestMapping("/news.html")
	public String news() {		
		return "index/news";
	}
	
	//联系我们
	@RequestMapping("/contactus.html")
	public String contactus() {		
		return "index/contactus";
	}
	
	public static void main(String[] args) throws IOException {
		String[] strings= {"周杰伦&KobeBryant-天地一斗.mp3",
		                  "周杰伦&杨瑞代-我要夏天.mp3",
		                  "周杰伦&杨瑞代-爱的飞行日记.mp3",
		                  "周杰伦&派伟俊-Try.mp3",
		                  "周杰伦&袁咏琳-怎么了.mp3",
		                  "周杰伦&袁咏琳-画沙.mp3",
		                  "周杰伦&费玉清-千里之外.mp3",
		                  "周杰伦-MineMine.mp3",
		                  "周杰伦-Now You See Me.mp3",
		                  "周杰伦-一口气全念对.mp3",
		                  "周杰伦-一点点.mp3",
		                  "周杰伦-一路向北.mp3",
		                  "周杰伦-七里香.mp3",
		                  "周杰伦-三年二班.mp3",
		                  "周杰伦-上海1943.mp3",
		                  "周杰伦-上海一九四三.mp3",
		                  "周杰伦-不能说的秘密.mp3",
		                  "周杰伦-不该.mp3",
		                  "周杰伦-世界末日.mp3",
		                  "周杰伦-东风破.mp3",
		                  "周杰伦-乌克丽丽.mp3",
		                  "周杰伦-乔克叔叔.mp3",
		                  "周杰伦-乱舞春秋.mp3",
		                  "周杰伦-以父之名.mp3",
		                  "周杰伦-伊斯坦堡.mp3",
		                  "周杰伦-你听得到.mp3",
		                  "周杰伦-你好吗.mp3",
		                  "周杰伦-借口.mp3",
		                  "周杰伦-傻笑.mp3",
		                  "周杰伦-免费教学录影带.mp3",
		                  "周杰伦-公主病.mp3",
		                  "周杰伦-公公偏头痛.mp3",
		                  "周杰伦-兰亭序.mp3",
		                  "周杰伦-分裂.mp3",
		                  "周杰伦-前世情人.mp3",
		                  "周杰伦-千山万水.mp3",
		                  "周杰伦-半兽人.mp3",
		                  "周杰伦-半岛铁盒.mp3",
		                  "周杰伦-印第安老斑鸠.mp3",
		                  "周杰伦-双刀.mp3",
		                  "周杰伦-双节棍.mp3",
		                  "周杰伦-反方向的钟.mp3",
		                  "周杰伦-发如雪.mp3",
		                  "周杰伦-可爱女人.mp3",
		                  "周杰伦-同一种调调.mp3",
		                  "周杰伦-听妈妈的话.mp3",
		                  "周杰伦-听爸爸的话.mp3",
		                  "周杰伦-听见下雨的声音.mp3",
		                  "周杰伦-告白气球.mp3",
		                  "周杰伦-周大侠.mp3",
		                  "周杰伦-哪里都是你.mp3",
		                  "周杰伦-嘻哈空姐.mp3",
		                  "周杰伦-四季列车.mp3",
		                  "周杰伦-四面楚歌.mp3",
		                  "周杰伦-回到过去.mp3",
		                  "周杰伦-园游会.mp3",
		                  "周杰伦-困兽之斗.mp3",
		                  "周杰伦-土耳其冰淇淋.mp3",
		                  "周杰伦-外婆.mp3",
		                  "周杰伦-夜曲.mp3",
		                  "周杰伦-夜的第七章.mp3",
		                  "周杰伦-大笨钟.mp3",
		                  "周杰伦-天涯过客.mp3",
		                  "周杰伦-她的睫毛.mp3",
		                  "周杰伦-好久不见.mp3",
		                  "周杰伦-威廉古堡.mp3",
		                  "周杰伦-娘子.mp3",
		                  "周杰伦-安静.mp3",
		                  "周杰伦-完美主义.mp3",
		                  "周杰伦-对不起.mp3",
		                  "周杰伦-将军.mp3",
		                  "周杰伦-床边故事.mp3",
		                  "周杰伦-开不了口.mp3",
		                  "周杰伦-彩虹.mp3",
		                  "周杰伦-心雨.mp3",
		                  "周杰伦-忍者.mp3",
		                  "周杰伦-惊叹号.mp3",
		                  "周杰伦-懦夫.mp3",
		                  "周杰伦-我不配.mp3",
		                  "周杰伦-我的地盘.mp3",
		                  "周杰伦-我落泪，情绪零碎.mp3",
		                  "周杰伦-手写的从前.mp3",
		                  "周杰伦-手语.mp3",
		                  "周杰伦-扯.mp3",
		                  "周杰伦-搁浅.mp3",
		                  "周杰伦-斗牛.mp3",
		                  "周杰伦-断了的弦.mp3",
		                  "周杰伦-无双.mp3",
		                  "周杰伦-时光机.mp3",
		                  "周杰伦-明明就.mp3",
		                  "周杰伦-星晴.mp3",
		                  "周杰伦-晴天.mp3",
		                  "周杰伦-暗号.mp3",
		                  "周杰伦-最后的战役.mp3",
		                  "周杰伦-最长的电影.mp3",
		                  "周杰伦-本草纲目.mp3",
		                  "周杰伦-枫.mp3",
		                  "周杰伦-梦想启动.mp3",
		                  "周杰伦-梯田.mp3",
		                  "周杰伦-止战之殇.mp3",
		                  "周杰伦-比较大的大提琴.mp3",
		                  "周杰伦-水手怕水.mp3",
		                  "周杰伦-流浪诗人.mp3",
		                  "周杰伦-浪漫手机.mp3",
		                  "周杰伦-漂移.mp3",
		                  "周杰伦-火车叨位去.mp3",
		                  "周杰伦-烟花易冷.mp3",
		                  "周杰伦-爱你没差.mp3",
		                  "周杰伦-爱在西元前.mp3",
		                  "周杰伦-爱情废柴.mp3",
		                  "周杰伦-爱情悬崖.mp3",
		                  "周杰伦-爷爷泡的茶.mp3",
		                  "周杰伦-爸我回来了.mp3",
		                  "周杰伦-牛仔很忙.mp3",
		                  "周杰伦-献世（LIVE）.mp3",
		                  "周杰伦-珊瑚海.mp3",
		                  "周杰伦-琴伤.mp3",
		                  "周杰伦-甜甜的.mp3",
		                  "周杰伦-疗伤烧肉粽.mp3",
		                  "周杰伦-白色风车.mp3",
		                  "周杰伦-皮影戏.mp3",
		                  "周杰伦-稻香.mp3",
		                  "周杰伦-窃爱.mp3",
		                  "周杰伦-等你下课.mp3",
		                  "周杰伦-简单爱.mp3",
		                  "周杰伦-算什么男人.mp3",
		                  "周杰伦-米兰的小铁匠.mp3",
		                  "周杰伦-红尘客栈.mp3",
		                  "周杰伦-红模仿.mp3",
		                  "周杰伦-给我一首歌的时间.mp3",
		                  "周杰伦-美人鱼.mp3",
		                  "周杰伦-自导自演.mp3",
		                  "周杰伦-花海.mp3",
		                  "周杰伦-英雄.mp3",
		                  "周杰伦-菊花台.mp3",
		                  "周杰伦-蒲公英的约定.mp3",
		                  "周杰伦-蓝色风暴.mp3",
		                  "周杰伦-蛇舞.mp3",
		                  "周杰伦-蜗牛（LIVE）.mp3",
		                  "周杰伦-说了再见.mp3",
		                  "周杰伦-说好的幸福呢.mp3",
		                  "周杰伦-说走就走.mp3",
		                  "周杰伦-超人不会飞.mp3",
		                  "周杰伦-超跑女神.mp3",
		                  "周杰伦-跨时代.mp3",
		                  "周杰伦-轨迹.mp3",
		                  "周杰伦-迷迭香.mp3",
		                  "周杰伦-迷魂曲.mp3",
		                  "周杰伦-退后.mp3",
		                  "周杰伦-逆鱗.mp3",
		                  "周杰伦-阳光宅男.mp3",
		                  "周杰伦-阳明山.mp3",
		                  "周杰伦-雨下一整晚.mp3",
		                  "周杰伦-霍元甲.mp3",
		                  "周杰伦-青花瓷.mp3",
		                  "周杰伦-鞋子特大号.mp3",
		                  "周杰伦-魔术先生.mp3",
		                  "周杰伦-麦芽糖.mp3",
		                  "周杰伦-黄金甲.mp3",
		                  "周杰伦-黑色幽默.mp3",
		                  "周杰伦-黑色毛衣.mp3",
		                  "周杰伦-龙卷风.mp3",
		                  "周杰伦-龙战骑士.mp3",
		                  "周杰伦-龙拳.mp3"};
		for(String str:strings) {
			byte[] browser = HttpUtils.browser("https://gitee.com/lcfms/zjl/raw/master/mp3/"+str, "user_locale=zh-CN; oschina_new_user=false; __guid=120207262.7604362000594879.1545298145965.4475; Serve_State=true; gr_user_id=e1d86c0c-3333-4fcf-9120-d5b0a6bfd923; grwng_uid=7b50b94f-0460-46fb-825f-c1aac57bdb4b; aliyungf_tc=AQAAAIym3E/8KQMAotNVb5tTisgPwDYe; tz=Asia%2FShanghai; abaa2ee5652ffb08_gr_session_id=79032260-eea4-4778-bdaf-1aa147373705; abaa2ee5652ffb08_gr_session_id_79032260-eea4-4778-bdaf-1aa147373705=true; secure_key=3EDDE426CD6AD39A0F28FF845A4CC4F39E7864D8EC4C7B30B0082586599EEAAF91D293A208C004CFA9B792C00C7E82887B0D235B954EC1C5D4E96A3971442698; remember_user_token=BAhbB1sGaQMGgQlJIiIkMmEkMTAkWU94SDE0cmUxUWdMcnRucGpkcW5wTwY6BkVU--0c1b655fec0c9e430f236c13597cf0a8d99e16d4; remote_way=http; Hm_lvt_24f17767262929947cc3631f99bfd274=1556969996,1556970941,1556971076,1556973207; Hm_lpvt_24f17767262929947cc3631f99bfd274=1556973427; monitor_count=106; gitee-session-n=BAh7C0kiD3Nlc3Npb25faWQGOgZFVEkiJTUzZDEwZjkwMGYxYmQ1NTdmNDU1YzBlODEyOTYxZGI4BjsAVEkiF21vYnlsZXR0ZV9vdmVycmlkZQY7AEY6CG5pbEkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsHWwZpAwaBCUkiIiQyYSQxMCRZT3hIMTRyZTFRZ0xydG5wamRxbnBPBjsAVEkiHXdhcmRlbi51c2VyLnVzZXIuc2Vzc2lvbgY7AFR7BkkiFGxhc3RfcmVxdWVzdF9hdAY7AFRJdToJVGltZQ2M0B3AuX61lwk6DW5hbm9fbnVtaQIcAzoNbmFub19kZW5pBjoNc3VibWljcm8iB3lgOgl6b25lSSIIVVRDBjsAVEkiF2FjdGl2ZV9lbWFpbF9ndWlkZQY7AEZGSSIQX2NzcmZfdG9rZW4GOwBGSSIxWWlISWluSEc2MDIwU0N1K3Qrbzl4WWJXVFFmdHp4WG5va2pvTHB5dE44cz0GOwBG--7cb449b134b57a20d61b90e78db0933a593196e2");
			File file=new File("D:\\javaproject\\zjl\\"+str);
			FileUtils.writeByteArrayToFile(file, browser);
			System.out.println(str);
		}
		
	}
		
}
